<template>
	<view class="home">
		<ty-tab-around :list="tabsList" :list-key="listKey" :active.sync="tabsIndex" @click="changeTabs"
			lineColor='#111111' lineWidth='345'>
		</ty-tab-around>
		<view class="flex align-center padding-tb-20 padding-lr-30">
			<view class="searchbg">
				<text class="tyIcon-search text-66"></text>
				<input type="text" placeholder="搜索包间名或主题名" @confirm="getSearch" v-model="title" class="flex-one margin-left-20 text-32" />
			</view>
		</view>
		<view class="text-32 margin-bottom-20 padding-lr-30 margin-top-20 text-bold">全部：</view>
		<view class="padding-30  margin-lr-30 bg-ff radius-40 margin-bottom-40 bg-shadow" v-for="(item,index) in list"
			:key="index" @click="go('/pages/board/roomdetail?id='+item.id+'&shop_id='+shop_id+'&type=order')">
			<view class="flex align-center">
				<view class="ztbtn">桌游主题：{{item.theme}}</view>
				<view class="flex-one flex align-center justify-end text-28">
					<!-- <image src="" mode=""></image> -->
					<view class="">{{item.time_slot}}</view>
				</view>
			</view>
			<view class="flex align-center">
				<image :src="item.image_url" mode="" class="bjimg"></image>
				<view class="flex-one margin-left-30">
					<view class="text-32">{{item.title}}</view>
					<view class="text-28 text-66 margin-top-5">押金 <text class="text-red">￥{{item.deposit}}/人</text>
					</view>
					<view class="text-28 text-66 margin-top-5">桌游主题：{{item.theme}}</view>
					<view class="flex align-center margin-top-20 justify-between">
						<view class="text-24 text-99 text-center" v-if="item.shared_table!=0">
							可接受拼桌{{item.left_count}}人
						</view>
						<view class="text-24 text-red" v-if="item.shared_table==0">不可接受拼桌</view>
						<view class="listbtn"
							@click="go('/pages/board/roomdetail?id='+item.id+'&shop_id='+shop_id+'&type=order'+'&tn='+tabsIndex)">
							选择加入</view>
					</view>
				</view>
			</view>
		</view>
		<view class="subbtn" @click="go('/pages/board/mymake')">我有预约</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabsList: ['包间列表', '大厅桌号'],
				tabsIndex: 0,
				// 显示key
				listKey: '',
				shop_id: "",
				num: "",
				is_put: "",
				list: [],
				title:""
			}
		},
		onLoad(options) {
			console.log(options)
			if (options.scene) {
				uni.setStorageSync('shop_id', options.scene)
			}
			this.shop_id = uni.getStorageSync('store_id')
		},
		onReady() {
			this.loadList(1)
		},
		methods: {
			changeTabs(e) {
				this.tabsIndex = e.index
				this.loadList()
			},
			loadList() {
				var that = this
				that.rq.getData('room/room_list', {
					room_type: that.tabsIndex == 0 ? '包间' : '大厅',
					lights_id: uni.getStorageSync('lampid'),
					title:that.title
				}).then(res => {
					if (res.code == 1) {
						this.list = res.data
					}
				})
			},
			getSearch(){
				this.loadList(1)
			}
		}
	}
</script>

<style>
	.home {
		width: 100%;
		min-height: 100vh;
		background: #fff;
		padding-bottom: 300rpx;
	}

	.searchbg {
		width: 100%;
		height: 80rpx;
		background: #F3F3F3;
		border-radius: 1998rpx 1998rpx 1998rpx 1998rpx;
		display: flex;
		align-items: center;
		padding: 0 20rpx;
	}

	.bjimg {
		width: 226rpx;
		height: 226rpx;
		border-radius: 40rpx;
	}

	.listbtn {
		width: 174rpx;
		height: 60rpx;
		background: #101010;
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 60rpx;
		text-align: center;
	}

	.subbtn {
		width: 690rpx;
		height: 88rpx;
		background: #101010;
		box-shadow: 0rpx 16rpx 80rpx 0rpx rgba(66, 66, 67, 0.25);
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 88rpx;
		text-align: center;
		position: fixed;
		bottom: 252rpx;
		left: 30rpx;
		right: 30rpx;
	}

	.ztbtn {
		/* width: 222rpx; */
		height: 46rpx;
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		border: 2rpx solid #111111;
		font-size: 24rpx;
		color: #111111;
		line-height: 46rpx;
		padding: 0 10rpx;
		margin-bottom: 20rpx;
	}
</style>